#include <stdio.h>
#include <string.h>


typedef struct Person
{
    int age;
    char name[20];
    char sex;
}Person;

int myStrlen(const char *str)
{
    //判空
    if(str == NULL)
    {
        return 0;
    }

    //计数
    int cnt;

    while(*str != '\0')
    {
        cnt++;
        str++;
    }
    return cnt;
}

int main()
{
    const char *str1 = "hello world";
    const char *str2 = "welcome to monday!";

    int length = myStrlen(str2);
    printf("length = %d\n", length);

    // printf("*str = %c\n", *str);
    // printf("*str = %c\n", *(str+1));

    length = strlen(str1);
    printf("length = %d\n", length);

    Person per;
    per.age = 20;
    strcpy(per.name, "zhangsan");
    per.sex = 'm';

    printf("hello world\n");
    
    const char *str2 = "NULL";
    length = myStrlen(str2);
    printf("length = %d\n", length);



    return 0;
}